<!-- include tpl=head_lay nopadding=true -->
<script type="text/javascript">
var obj_upload = {};
var obj = art.dialog.opener;
function cate_change()
{
	val = $("#cateid").val();
	if(!val){
		$.dialog.alert('请选择要存储的目标分类');
		return false;
	}
	var url = get_url('res','add','cateid='+val);
	$.phpok.go(url);
}
function save()
{
	var f = $("#upload_progress .phpok-upfile-list").length;
	if(f<1){
		$.dialog.alert('请选择要上传的文件');
		return false;
	}
	obj_upload.uploader.on('uploadFinished',function(){
		$.dialog.alert('附件上传成功',function(){
			obj.$.phpok.reload();
		});
	});
	obj_upload.uploader.upload();
	return false;
}
function cancel()
{
	return obj_upload.uploader.stop();
}
</script>
<div class="layui-card">
	<div class="layui-card-body layui-form">
		<div class="layui-form-item">
			<label class="layui-form-label">
				{lang附件分类}
			</label>
			<div class="layui-input-block">
				<select id="cateid" lay-ignore name="cateid" onchange="cate_change()">
					<!-- loop from=$catelist key=$key value=$value -->
					<option value="{$value.id}"{if $cateid == $value.id} selected{/if} data="{$value.filetypes}" catename="{$value.title}">
					{$value.title}<!-- if $value.typeinfos --> / {lang支持上传格式：}{$value.typeinfos}<!-- /if --></option>
					<!-- /loop -->
				</select>
			</div>
			<div class="layui-input-block mtop">{lang请选择要上传的附件分类}</div>
		</div>
		<div class="layui-form-item">
			<label class="layui-form-label">
				{lang选择文件}
			</label>
			<div class="layui-input-block">
				{$html}
			</div>
			<div class="layui-input-block mtop"></div>
		</div>
	</div>
</div>

<!-- include tpl=foot_lay is_open=true -->